%%%This template was made by Cameron But anyone can use it

\documentclass[11pt,twoside]{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% End Document Specs Here
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%------------page layout
\usepackage[left=2cm,top=3cm,right=2cm,bottom=2cm]{geometry} %changes margins
\usepackage[parfill]{parskip} % begin paragraphs with an empty line not indent
%\usepackage{multicol}

%%-----------section styles
\usepackage{sectsty}
    %Put period after section number
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
{\csname the#1\endcsname\quad}% default
{\csname #1@cntformat\endcsname}% individual control
}
\def\section@cntformat{\thesection.\quad}
\def\subsection@cntformat{\thesubsection.\quad}
\makeatother
\sectionfont{\bf\large\raggedright}
\subsectionfont{\bf\normalsize\raggedright}
\subsubsectionfont{\bf}


%%------------font choices
%\usepackage[math]{anttor}
%\usepackage[varg]{txfonts}
%\usepackage[scaled=.9]{couriers}
%\usepackage[utopia]{mathdesign}
%\usepackage{fourier}
\usepackage{palatino}

%%------------graphics
\usepackage{graphicx,epstopdf}
\usepackage{subfigure}

%%------------mathematics
\usepackage{amsmath,amssymb,amsthm}

%%------------bibliography
\usepackage{natbib}
%\setcitestyle{square,aysep={},yysep={;}}
\bibliographystyle{agufull}%abbrvnat,plainnat,unsrtnat

%%------------tables
\usepackage{booktabs}

%%------------misc
\usepackage{verbatim}
\usepackage[pdftex,bookmarks,colorlinks,breaklinks]{hyperref}
\hypersetup{linkcolor=black,citecolor=black,filecolor=black,urlcolor=black}


%%-----------custom environments
%%enumerate and itemize with smaller spacing
\newenvironment{myen}{
\begin{enumerate}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}}{\end{enumerate}
}
\newenvironment{myit}{
\begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}}{\end{itemize}
}
\renewcommand{\[}{\begin{equation}}
\renewcommand{\]}{\end{equation}}


%%-----------page header declaration
\newcommand{\Ohead}{E492 FALL 2008}                %header for Odd pages
\newcommand{\Ehead}{ARCATA BRACKISH MARSH}  %header for Even pages
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[CE]{\small \Ehead}
\fancyhead[CO]{\small \Ohead}
\fancyhead[LE,RO]{\thepage}   %page numbers

%%-----------nicer looking captions
\usepackage[font={bf,footnotesize},textfont=md,margin=30pt,aboveskip=0pt,belowskip=0pt]{caption}

%%-----------PGF/TIKZ
%\usepackage{tikz}
%\usepackage{pgf}
%\usetikzlibrary{arrows,shapes,positioning}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% End Document Specs Here
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Document Starts Here
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\thispagestyle{empty}

~\vspace{8cm}
\begin{center}
    \textbf{\Large Arcata Brackish Marsh Capstone Project - Individual Writing Component}
    {\bf\\ Cameron Bracken \\}
    E492 October 13, 2008
\end{center}
\clearpage

\thispagestyle{empty}
\tableofcontents
\listoffigures
\listoftables
\clearpage


\setcounter{page}{1}




\section{Introduction}


This report will describe the Humboldt State Engineering 492 Project concerning the Arcata Brackish Marsh.  The Brackish Marsh is a proposed addition to the Arcata Marsh treatment system and was constructed during the summer of 2008.  The Arcata Marsh is an integrated wastewater treatment system and wildlife sanctuary (Figure \ref{fig:scale-marsh}).

\begin{figure}[!ht]
\centering
%\input{figs/aerial.pgf}
\caption{Simplified diagram of the Arcata Waste treatment System.}\label{fig:scale-marsh}
\end{figure}


At the time of writing, the Brackish Marsh has yet to be incorporated as a part of the Marsh Treatment system.  The goal of this report is to aid in some of the pending decisions related to the incorporation of the Brackish Marsh.  Specifically we seek to answer some key questions such as , ``Is it feasible to operate the Brackish Marsh in series with the existing system?'' and ``Is it feasible to operate with a single discharge point?''   Aside from these feasibility questions we seek to aid in operation of the system during extreme inflow events by producing a forecast of the treatment plant inflow.

Section \ref{sec:back} describes in detail the existing conditions of the Marsh treatment system and some of the proposed conditions after the incorporation of the Brackish Marsh.  Additionally section \ref{sec:back} will further describe the scope, components, and goals of this project.

Section \ref{sec:litrev} contains a review of relevant literature related to other existing brackish marshes, attempts at inflow modeling, and modeling of the marsh system.

Section \ref{sec:meth} describes the technical details of our precipitation based inflow model and hydraulic model of the marsh system model.



\section{Background}\label{sec:back}

\subsection{History of the Arcata Wastewater Treatment Facility}

The Site of the Arcata Wastewater Treatment Facility was historically a brackish wetland.  Increased population during the timber boom resulted in filling and diking of the wetlands.  Arcata had no wastewater treatment system until the 1940's when a primary treatment facility was installed.  Secondary treatment was added in 1958 in the form of oxidation ponds.  In 1968 chlorination was added to the treatment process and in 1975 dechlorination was added \citep{EcoTippingPoints2008}.  In 1977 Arcata rejected a regional wastewater treatment system in favor of the current marsh system.

\subsection{Arcata Wastewater Treatment Facility}

At the time of construction the Arcata Wastewater Treatment Facility consisted of a conventional primary treatment facility, a series of ponds and marshes as secondary treatment, wetlands tertiary treatment and finally chlorination before discharge into Humboldt Bay.  The ponds, called Oxidation Ponds or Ox Ponds, cover 45 acres; The marshes, called the Treatment Marshes or TMs cover 5 acres;  The wetlands, also called the Enhancement Marshes or EMs cover 28 acres \citep{CH$_2$MHill1984}.  The system was built in 1984 and was designed for an average municipal flow of 2.3 MGD.   Winter flows often reach over 5 MGD and in etreme events, can reach 10 MGD.  Higher winter flows are primarily due to storm water inflow and infiltration, not increased human usage.

The primary treatment is a conventional system.  The main purpose is removal and digestion of of large debris from the wastewater. Primary treatment is accomplished through a headworks followed by grit chambers followed by a clarifier and then a digester.  Water is drained from the top of the digesters and sent to secondary treatment.

Secondary treatment starts with three Ox Ponds in series.  The purpose of these ponds is removal of biological oxygen demand (BOD), total suspended solids (TSS), nitrogen, phosphorus, and pathogens through settling and bacterial oxidation \citep{Finney2008}.  The Treatment Marshes follow the Ox Ponds.  Dense plant material in these marshes filter out solids and allow for additional settling.  Plant in the TMs uptake phosphorus and nitrogen as well as prevent algae growth by blocking sunlight.  The connections of the Ox Ponds and the TMs can be changed depending on the flows through the system.  During High flow events, the treatment marshes can be completely bypassed \citep{Lust2008}.  Table \ref{tab:high-flow}  shows how total flow through the system in incrementally controlled during high flows.  The precise connections of the TMs and Ox Ponds are diagramed later.

\begin{table}[!htbp]
   \centering
   \caption{Incremental pumping capacity based on various pumping scenarios.}
   \begin{tabular}{@{} ccccc @{}}
      \toprule
      \multicolumn{2}{@{} l}{Daily Operational Pumps}&
      \multicolumn{2}{c @{}}{Emergency Pumps} &\\
      \cmidrule(r){1-4}
      TM & Ox Pond & Ox Pond 3 & Ox Pond 2 & Total Capacity (MGD) \\
      \midrule
      2 & 1 & 0 & 0 & 4.5 \\
      3 & 1 & 0 & 0 & 4.9 \\
      3 & 3 & 0 & 0 & 6.0 \\
      3 & 3 & 1 & 0 & 7.5 \\
      3 & 3 & 2 & 0 & 8.4 \\
      3 & 3 & 2 & 1 & 11.9 \\
      3 & 3 & 2 & 2 & 13.6 \\
      \bottomrule
   \end{tabular}\label{tab:high-flow}
\end{table}


After secondary treatment, water flows to the chlorine contact basin and then to the Enhancement Marshes.  The EMs consist the George Allen Marsh, the Bob Gearheart Marsh and the Jeff Hauser Marsh.  The existing conditions have flow going from the chlorine contact basin to Allen Marsh to Gearheart Marsh to Hauser Marsh and then back to the contact basin where some water is discharged to Humboldt Bay (Figure \ref{fig:tm-current}).  The current setup causes some water to be chlorinated twice, but the mixing of flows serves to buffer the quality of the bay effluent.

\begin{figure}[!ht]
\centering
\includegraphics{figs/tm-current.pdf}
\caption{Schematic diagram of current connections.}\label{fig:tm-current}
\end{figure}




\subsection{Regulations and Permits}

The AWTF is required to meet State and Federal discharge standards.  The Federal regulations are governed by the Clean Water Act and state regulations are governed by the California Water Code.

\subsubsection{Federal Regulations}

The Clean WAter Act is enforced by the The Environmental Protection Agency (EPA).  The EPA's system, the National Pollutant Discharge Elimination System (NPDES) requires a permit for surface water discharges such as those made by the AWTF.  An NPDES permit requires Arcata's effluent to improve the quality of Humboldt Bay \citep{Engr1152008}.


\subsubsection{State Regulations}

The North Coast Regional Water Quality Control Board (NCRWQCB) is the regional body in charge of regulating the discharge of the AWTF.  Arcata is granted an exception under the current Water Quality Control Plan which allows for the current discharge into the bay provided the water quality of the bay is enhanced.

\subsubsection{Current Discharge Permit}

AWTF discharge permits are granted for a period of 5 years.  The current permit (NPDES Permit No. CA0022713) was granted in June 2004 and will expire in June 2009.  The Permit regulates two discharge points.  The first discharge, Outfall No. 001, is Butcher's Slough.  The second discharge, Outfall No. 002, is the inflow to the enhancement marshes \citep{CRWQCB2004}.  The permit also restricts discharge that is not specifically allowed.  Table 1 and 2 show the permit specifications for Outfall No. 001 and 002.


\begin{table}[!htbp]
   \centering
   \caption{Discharge limitations at Outfall No. 001 \citep{CRWQCB2004}.}
   \begin{tabular}{@{} ccccc @{}}
      \toprule
        & Units & Monthly Average & Weekly Average & Daily Maximum \\
      \midrule
      BOD$_5$           & mg/L      & 30                  & 45 & 60   \\
      Suspended Solids  & mg/L      & 30                  & 45 & 60   \\
      Settleable Solids & mL/L      & 0.1                 & -  & 0.2  \\
      Fecal Coliform    & MPN/100mL & 14                  & -  & 43   \\
      pH                & Standard  & $>$ 6.0 and $<$ 9.0 &    &      \\
      Copper            & $\mu$g/L  & 2.8                 & -  & 5.7  \\
      Zinc              & $\mu$g/L  & 47                  & -  & 95   \\
      Cyanide           & $\mu$g/L  & 0.5                 & -  & 1.0  \\
      2,3,7,8-TCDD TEQ  & pg/L      & 0.014               & -  & 0.028\\
      \bottomrule
   \end{tabular}\label{tab:001}
\end{table}

\begin{table}[!htbp]
   \centering
   \caption{Discharge limitations at Outfall No. 002 \citep{CRWQCB2004}.}
   \begin{tabular}{@{} ccccc @{}}
      \toprule
        & Units & Monthly Average & Weekly Average & Daily Maximum \\
      \midrule
      BOD$_5$           & mg/L      & 30                  & 45 & 60   \\
      Suspended Solids  & mg/L      & 30                  & 45 & 60   \\
      Settleable Solids & mL/L      & 0.1                 & -  & 0.2  \\
      Fecal Coliform    & MPN/100mL & 23                  & -  & 230   \\
      pH                & Standard  & $>$ 6.0 and $<$ 9.0 &    &      \\
      \bottomrule
   \end{tabular}\label{tab:002}
\end{table}

\subsubsection{Permit Violations}

A violation occurs when levels of a group I pollutant exceed the standards by 40\% or if a group II pollutant exceeds by 20\% or more.  The City of Arcata is fined a maximum of \$10,000 for each day a violation occurs.  The city can be additionally fined \$10 per gallon of discharge in excess of 1,000 gallons.  For a single serious violation, the mandatory minimum penalty is \$3,000 \citep{CRWQCB2007}.  The City of Arcata is currently in the process of renegotiating these permits due to a high number of violations between June 2004 and March 2007, resulting in a mandatory minimum penalty of \$54,000 and a maximum fine of \$216,000 \citep{CRWQCB2008}.


\section{The Brackish Marsh}

\subsection{Brackish Marsh Vision}

The Brackish marsh was designed to receive 1 to 6 cfs of fresh water from the combined Arcata Waste Treatment Facility effluent and surface runoff from the surrounding area.  Salt water will enter through a muted tidal gate.  The Brackish marsh is intended to add additional treatment and storage capacity to the system and provide habitat as outlined in the McDaniel Slough Restoration Project \citep{COA2008}.

\subsection{Integration of the Brackish Marsh Into the Existing System}

Stakeholders in the Brackish Marsh include the City of Arcata, The Department of Fish and Game, The Arcata Waste Treatment Facility (AWTF) and the North Coast Regional Water Quality Control Board (NCRWQCB).  There are various scenarios for integrating the Brackish Marsh into the existing treatment train, which are supported in varying degrees by the different stakeholders \citep{Andre2008}.

The first scenario shown in Figure \ref{fig:tm-all-series} would have all of the treatment Marshes connected in series.  This would allow for maximum treatment capacity as well as the maximum possible storage capacity.  This scenario is favored by the City of Arcata and the AWTF.

\begin{figure}[!ht]
\centering
\includegraphics{figs/tm-all-series.pdf}
\caption{Schematic diagram of possible connection scenario with all enhancement marshes in series with the brackish marsh for maximum treatment.}\label{fig:tm-all-series}
\end{figure}

In second scenario shown in Figure \ref{fig:tm-none} the treatment marshes would be removed completely from the treatment train.  The permit for this scenario would be located after the contact basin.  This scenario would allow the NCRWQCB to claim the TMs as waters of the state.

\begin{figure}[!ht]
\centering
\includegraphics{figs/tm-none.pdf}
\caption{Schematic diagram of possible connection scenario with all enhancement marshes removed completely from the treatment process.}\label{fig:tm-none}
\end{figure}

The third and fourth scenarios in Figures \ref{fig:tm-no-hauser} and \ref{fig:tm-allen-only} are involve deactivating one or more of the marshes but not completely removing them.

\begin{figure}[!ht]
\centering
\includegraphics{figs/tm-no-hauser.pdf}
\caption{Schematic diagram of possible connection scenario with the marshes in series and Hauser removed.}\label{fig:tm-no-hauser}
\end{figure}

\begin{figure}[!ht]
\centering
\includegraphics{figs/tm-allen-only.pdf}
\caption{Schematic diagram of possible connection scenario with only Allen Marsh in use.}\label{fig:tm-allen-only}
\end{figure}

Within the AWTF, a possible scenario is the addition of three additional treatment marshes.  The three marshes would add treatment capacity but the increase in storage capacity would not be significant \citep{Gearheart2008}.



\subsection{Project Goals and Deliverables}

The goals for this project are to (1) conduct feasibility study for incorporation of the Brackish Marsh and (2) create a tool which may aid in the the day to day operations of the plant.  For both analyses, a numerical flow model will be used to asses the flow of water through the system and indirectly asses treatment capacity.  The feasibility study will use historical inflow and rainfall data. The most beneficial scenario in terms of treatment is the one in which all the TMs are connected in series, so this scenario will be of particular interest in the feasibility study.

In addition to the feasibly study we plan to develop a simple tool for predicting water levels in the various ponds.  The hope is that this tool will serve as an aid to treatment plant operators in day to day operations by giving forewarning of high inflows and subsequently high water levels in the ponds and marshes.  The tool will incorporate a precipitation based inflow model which will drive the flow model.


\section{Literature Review}\label{sec:litrev}

This section gives a review of relevant literature related to inflow forecasting and hydraulic modeling of a Brackish Marsh system.

\subsection{Tide Gates and Brackish Marshes}

Tide gate are used to regulate the inflow of salt water into a estuary or marsh \citep{Giannico2005}.  As is the case in Arcata, tide gates along with a dike system are used to drain estuaries and marshes for development \citep{Charland1998}.  Tide gates typically operate as a one way valve allowing.  Tide gates are typically constructed from heavy material requiring a specific head differential to open.  Where fish passage is a concern small opening in the tide gate can be used called pet doors.  A pet door operates via a float and is designed to open when conditions are suitable for fish passage.  One example of a tide gate with a pert door is the Muted Tidal Regulator (MTR) \citep{Giannico2005}.

Modeling the flow through a tide gate is similar to that through a culvert.  \cite{Porior} gives equations for submerged and partially submerged flow through a pet door which is modeled as an orifice.  \cite{Litrico2005} also gives equations for when the tide gate begins to open (modeled as an orifice) and when the gate is fully opened (modeled as a weir).

\subsection{Inflow Forecasting}

The flow rate of water into a wastewater treatment plant (WWTP) is known as inflow.  Inflow to a WWTP is typically composed of a relatively constant (if not predictable) human component plus a component which is based on precipitation and groundwater levels.  The primary contribution to the non-human component is rainfall derived inflow and infiltration which is a major contributing factor to sanitary sewer overflows (SSO) \citep{Zhang2007}.  The magnitude of RDII is a function of how "leaky" a wastewater system is, i.e. how much storm water makes its way into the sewer system.  A system with high RDII is undesirable because it requires a WWTP be built with a higher capacity than the human demand on the system.

The following criteria are desirable in an forecast model for the inflow to the AWWTP:
\begin{myen}
\item No real-time inflow input,
\item Incorporates historical precipitation and inflow data,
\item Driven by only precipitation,
\item Accounts for seasonal and/or smaller scale periodicity,
\item Flexible and robust handling of outliers,
\item Simple to generate forecasts.
\end{myen}
These criteria are based on the availability of data.

Classification of a system's RDII involve measurement and analysis of flow at the outlet of a subbasin and nearby rainfall.   Traditional analysis ``are ad hoc in nature giving little or no consideration to their statistical validity''  \citep{Zhang2007}.  Other more recent approaches use autoregressive models \citep{Zhang2007} and artificial neural net models \citep{El-Din2002}.  An autoregressive model which involves inflow would require continual input of data for maximum forecast accuracy which conflicts with criteria 1 above.  Artificial neural networks, such as the one used in \cite{El-Din2002}, generally preform the best with large data sets which is not available for the AWWTP.  There have also been attempts at combined approaches using model weighting though this approach arguably conflicts with criteria 5 above \citep{Coulibaly2005}.

An alternative to the above methods is time series decomposition.  These methods decompose the available time series into periodic, nonstationary trend and residual components.  The idea is that after removing the periodic and trend components, the residuals of the decomposed precipitation and inflow series would be more highly correlated than the original series.  If the residuals were then regressed then a forecast could be precipitation driven without requiring a real time inflow data input.  At first glance this method satisfies all of our criteria for a model (though possibly not criteria 5).

The most well known time series decomposition method is X-11 \citep{Shiskin1967}.  This procedure has been drastically improved upon in the more modern seasonal-trend loess (STL) algorithm \citep{Cleveland1990}.  In particular this method satisfies criteria 3-5.  \cite{Cleveland1990} showed that the STL method worked well well with some well known data sets.

\subsection{Wetland Modeling}

In this study are directly modeling the hydraulics of the marsh and only indirectly modeling the water quality.  We made the decision to not to directly model the water quality due to lack of data.  Treatment capability of the system can be indirectly estimated based on retention times. The two general types of hydraulic models are distributed and lumped.

Distributed models are derived from force balances and describe capture small scale phenomenon such as velocity and pressure changes from which volume and surface elevations are derived.  These generally require more data to run than distributed models but provide more detailed information about the workings of the system.  Again, we decided against this type of model due to lack of data.

On the other hand lumped flow models are typically derived from mass balances and only give large scale information such as average pond depth and retention time.  In general these models are less computationally intensive than distributed models and require less data.  Reservoir models, a type of lumped model are particularly suited for wetland modeling.  Reservoir models discretize the system into a set of interconnected reservoirs.  PondPack is an example of a reservoir model used for wetland modeling \citep{Bentley2005}.  SETWET is another wetland model developed by \cite{Lee1999}.  HEC-RAS has also been proposed for use in highly vegetated wetland channels \citep{HEC2008}.


\section{Methodology}\label{sec:meth}

\subsection{Inflow Model}

This section will describe the procedure for forecasting the Plant inflow from the rainfall.  We use the Seasonal-Trend Loess (STL) procedure outlined in \cite{Cleveland1990} for decomposing periodic, non-stationary time series.  Along with being conceptually easy to understand, this procedure has many advantages such as being able to handle any size window of periodicity and missing data values \citep{Mcleod1999}.  For a generic time series $Y_v$ we can write it as the sum of a seasonal component, $S_v$, a non-stationary trend component, $T_v$, and a remainder, $R_v$, for all $v=1,2,...,n$ or

\[Y_v = S_v + T_v + R_v.\]

Most of the mathematical details of the procedure are beyond the scope of this report but we will provide a brief summary.  For full details see \cite{Cleveland1990}.  The procedure is an iterative one consisting of two main loops of computation.  The inner loop is iterated $n_i$ times where $k=1,...,n_i$ is the iteration number. The inner loop consists of:
\begin{myen}
    \item {\it Detrending:} The detrended series $Y_v-T_v^{(k)}$ is calculated.  On the first iteration choose $T_v^{(1)}= 0$.
    \item {\it Cycle-Subseries Smoothing:} $S_v^{(k+1)}$ is calculated to guarantee smoothness between periods but not necessarily between adjacent time intervals.  This allows for jumps, slips and missing values to be handled robustly.
    \item {\it Deseasonalizing:}  The deseasonalized series $Y_v-S_v^{(k+1)}$ is calculated.
    \item {\it Trend Smoothing:}  The deseasonalized series is smoothed via loess, a locally weighted polynomial regression method (this method is also used in the computation of $S_v^{(k+1)}$).  Thus we obtain $T_v^{(k+1)}$.
\end{myen}

The outer loop consists of the estimation of robustness weights which are applied to the  trend smoothing in Step 4 of the inner loop.  This process determines the degree to which outliers in $R_v = Y_v - T_v - S_v$ are damped in the trend smoothing.  Finally, the seasonal component is smoothed an additional time via loess to obtain the final values of $S_v$, $T_v$ and $R_v$.

We expect that the inflow time series $Y_{I,v}$ is a stronger function of the precipitation over the past $m$ days than it is of the single day's precipitation.  Let $Y_{P(m),v}$ be a variant of the precipitation time series $Y_{P,v}$, where
\[Y_{P(m),j}=\displaystyle\sum_{i=j-m}^jY_{P,i}.\]
Constructing the time series this way forces us to restrict $v$ from $m$ to $n$.

\[Y_{I,v} = S_{I,v} + T_{I,v} + R_{I,v}\label{idecomp}\]
and
\[Y_{P(m),v} = S_{P(m),v} + T_{P(m),v} + R_{P(m),v}\label{pdecomp}\]

We claim that the inflow residual is a linear function precipitation residual such that

\[R_{I,v} = a + bR_{P,v}\label{linreg}\]
where $a$ and $b$ are estimated via linear regression.

In a forecast setting where real-time incorporation of inflow data is not possible we must make some practical modifications:
\begin{myen}
    \item We assume the non-stationary trend in the inflow and precipitation is small compared to the seasonal and residual components and take the respective trend as constant average values $\phi_I$ and $\phi_{P(m)}$
    \[\phi_I={\displaystyle\sum_{i=m}^n T_{I,i}\label{iave} \over n-m}\]
and
    \[\phi_{P(m)}={\displaystyle\sum_{i=m}^n T_{R(m),i}\label{pave}\over n-m}\]
    \item We assume the seasonal component is constant from year to year and take the first year's component as representative of all the years in the record.  Thus the seasonal component is only a function of the day of the year $d$ and the starting day of the time series $d_o$ where $d,d_o\in\{1,2,...,365\}$ and
    \[d=mod\left[mod\left(v, 365\right)+d_o,365\right]\label{eqn:d}\]
so that
    \[S_{I,d} = S_{I,v} \,\,\,\,\,\,\,\,\,\forall v = 1,2,...,365\]
and
    \[S_{P(m),d} = S_{P(m),v} \,\,\,\,\,\,\,\,\,\forall v = 1,2,...,365.\]
Note that $mod$ is the remainder function.
\end{myen}

Given precipitation amounts for the last $m$ days, and the current day of the year, $d$, we can write the entire forecast procedure:

\begin{myen}
    \item Construct $Y_{P(m),v}$ from the original time series $Y_{P,v}$.
    \item Decompose $Y_{I,v}$ and $Y_{P(m),v}$ into the components in Equations \ref{idecomp} and \ref{pdecomp}.
    \item Caculate $\phi_I$ and $\phi_{R(m)}$ from Equations \ref{iave} and \ref{pave}
    \item Estimate $a$ and $b$ from Equation \ref{linreg}.
    \item Calculate $\mathcal{P}$ as the sum of the last $m-1$ days of observed precipitation plus the current day's precipitation forecast.
    \item Calculate $d$ from Equation \ref{eqn:d}.
    \item Obtain a forecast of the inflow $\mathcal{I}$ as
        \[\mathcal{I} = \left(\mathcal{P}+S_{P(m),d}+\phi_{P(m)}\right)b+a+S_{I,d}+\phi_{I}.\label{eqn:forecast}\]
    Notice that every value on the right hand side of Equation \ref{eqn:forecast} is simply a scalar and thus $\mathcal{I}$ is a scalar as well.
\end{myen}
In practice we carry out steps 1 - 4 only once using historical data and repeat only steps 5 - 7 to obtain a forecast.

\begin{figure}[htbp] %  figure placement: here, top, bottom, or page
   \centering
   \includegraphics{figs/inflow-model-schematic.pdf}
   \caption{Schematic of the forecasting procedure as carried out in practice.}
   \label{fig:inflow-model-schematic}
\end{figure}


\subsection{Linear-Reservoir Model}

The use of a linear-reservoir model requires some important assumptions: (1) the water surface within a pond is uniform at any given time, (2) identical stage-discharge behavior is exhibited during filling and emptying, and there are no large changes in the stage such that for some small amount of time there is is an essentially constant flow.  These assumptions allow us to write the change in head, $\Delta H$, as a function of the the time step $\Delta t$, the surface area $A$, and the volumetric flow rate $Q$ where

\[A\frac{\Delta H}{\Delta t} = Q_{in}-Q_{out}(H).\label{mass_balance_2}\]

The head is taken to be the head above the crest of the outflow weir for a given pond and the expression $Q_{out}(H)$ is the stage discharge relationship for that pond based on the outflow weir.  \cite{King1963} presents these equations in detail.  As with the tide gate, the form of these equations changes if the weir is submerged or not.

Accounting for friction loss in connecting pipes requires an iterative scheme as describe by \cite{Chow1988}.    The time dependent pond depths are calculated using third-order Runge Kutta algorithm.

\begin{figure}[!h] %  figure placement: here, top, bottom, or page
   \centering
   \includegraphics{figs/flow-model-schematic.pdf}
   \caption{Schematic of the iterative algorithm for calculating pond depths over time.}
   \label{fig:flow-model-schematic}
\end{figure}


\section{Application}

\subsection{Data and Data Sources}

\begin{figure}[htbp] %  figure placement: here, top, bottom, or page
   \centering
   \includegraphics[height=\textwidth,angle=-90]{figs/inflow-ts.pdf}
   \caption{Treatment Plant Inflow (in black) and Eureka Precipitation (in blue) plotted on the same axis.  There is an obvious positive correlation between rainfall and inflow, especially during the wet season.}
   \label{fig:ts}
\end{figure}

\clearpage

\bibliography{references}

\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Document Ends Here
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
